package com.mpyy.handler.purchase;

import com.alibaba.fastjson.JSON;
import com.mpyy.pojo.PurchaseStockDesc;
import com.mpyy.service.purchase.PurchaseStockDescInter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * @version 1.0
 * @Description
 * @Author zhangkaibo
 * @Date 2022-03-11 10:40
 */
//根据商品的单号查询单号里的商品详细信息
@RestController
public class PurchaseStockDescHandler {
    @Autowired
    @Qualifier("purchaseStockDescImpl")
    private PurchaseStockDescInter purchaseStockDescInter;

    @RequestMapping("/searchPurchaseStockDesc")
    public String searchPurchaseStockDesc(PurchaseStockDesc purchaseStockDesc){
        System.out.println(" invoke searchPurchaseStockDesc");
        System.out.println(purchaseStockDesc);
        List<PurchaseStockDesc> purchaseStockDescs =purchaseStockDescInter.searchPurchaseStockDesc(purchaseStockDesc);
        HashMap<Object, Object> inventoryCollectMap = new HashMap<>();
        System.out.println(purchaseStockDescs);
        inventoryCollectMap.put("code",0);
        inventoryCollectMap.put("msg","");
        inventoryCollectMap.put("count",purchaseStockDescs.size());
        inventoryCollectMap.put("data",purchaseStockDescs);
        return JSON.toJSONString(inventoryCollectMap);
    }
}
